﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using VideoClassLibrary.BusinessLogicLayer;
using VideoClassLibrary.Model;

public partial class Report_AdminVideoUserEnableReprot : AdminUserBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            this.BindingDDLSchool();
          //  this.reportInfo.InnerHtml = new UserModule().GetUserLogInfo(int.Parse(this.ddlSchoolFilter.SelectedValue));
        }
    }

    //protected void ddlSchoolFilter_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    if (!string.IsNullOrEmpty(this.ddlSchoolFilter.SelectedValue))
    //    {
    //        this.reportInfo.InnerHtml = new UserModule().GetUserLogInfo(int.Parse(this.ddlSchoolFilter.SelectedValue));
    //    }
    //}

    private void BindingDDLSchool()
    {
        List<SchoolReport> schoolReports =new List<SchoolReport>();
        DataSet ds = new SchoolModule().QueryAllSchool();
        if(ds.Tables[0].Rows.Count>0)
        {
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                new UserModule().GetUserLogInfo(dr, ref schoolReports);
            }
         
        }
        //List<SchoolReport> newschool = schoolReports.OrderByDescending(s => s.AvailableCount).Skip(pager.StartRecordIndex - 1).Take(pager.PageSize).ToList();
        //newschool.Sort();
        Repeater1.DataSource = schoolReports.OrderByDescending(s => s.AvailableCount).Skip(pager.StartRecordIndex - 1).Take(pager.PageSize);
        Repeater1.DataBind();
        pager.RecordCount = schoolReports.Count();
        //{
        //    this.ddlSchoolFilter.Items.Add(new ListItem("--请选择学校--", "0"));
        //    DataSet ds = new SchoolModule().GetSchoolListByWhere("");
        //    int rowsCount = ds.Tables[0].Rows.Count;
        //    if (rowsCount > 0)
        //    {
        //        for (int i = 0; i < rowsCount; i++)
        //        {
        //            this.ddlSchoolFilter.Items.Add(new ListItem(ds.Tables[0].Rows[i]["VS_name"].ToString(), ds.Tables[0].Rows[i]["ID"].ToString()));
        //        }
        //    }
    }

    protected void pager_PageChanged(object sender, EventArgs e)
    {
        BindingDDLSchool();

    }
}
